package demo.map;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public class MapIteration {

	public static void main(String[] args) {
		

		 Map<Integer, String> map=new HashMap<Integer, String>();
		 map.put(1, "welcome");
		 map.put(2, "test");
		 map.put(5, "generics");
		 map.put(9, "collection");
   
		 
	Set<Integer> set=	   map.keySet();
		   
		 for (Integer key: set) {
		//	 System.out.println(key);
			 
		String s=	   map.get(key);
		System.out.println(s);
		}
		 
		   
Set<Entry<Integer, String>> entrySet=		 map.entrySet();
		
        for (Entry<Integer, String> entry : entrySet) {
			System.out.println("key :"+entry.getKey()+ " | Value: "+entry.getValue());
		}

		
		
	}
}
